package com.macro.client.controller;

import com.macro.client.service.ProductService;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.ProductById;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ProductController
 * @Description 描述
 * @Author bai
 * @Date 2024/10/22 21:39
 */

@RestController
@RequestMapping("product")
public class ProductController {

    @Autowired
    private ProductService productService;

    /**
     * 根据id查商品详细
     */
    @GetMapping("/detail/{id}")
    public CommonResult<ProductById> detail(@PathVariable Integer id){
        ProductById productById = productService.fetchProductDetail(id);
        return CommonResult.success(productById);
    }
}
